package com.study.行为型模式.观察者模式;

public class CurrentConditions implements Observer{

    //温度，气压，湿度
    private float temperature;
    private float pressure;
    private float humidity;

    @Override
    public void update(float temperature, float pressure, float humidity) {
        this.temperature = temperature;
        this.pressure = pressure;
        this.humidity = humidity;
        display();
    }

    //显示
    public void display(){
        System.out.println("气象站");
        System.out.println("最新的气温为："+temperature);
        System.out.println("最新的气压为："+pressure);
        System.out.println("最新的温度为："+humidity);
    }
}
